package com.xls.commonlibrary.util;

import android.text.TextUtils;

import com.orhanobut.logger.Logger;

import java.text.DecimalFormat;

// 积分 换算工具
public class PointsUtil {

    public static String getLeft(String point) {

        Logger.d("======PointsUtil===getLeft==point======" + point);

        String value = "0";

        if (!TextUtils.isEmpty(point)) {
            double p = Long.parseLong(point);
            if (p > 0) {
                DecimalFormat df = new DecimalFormat("#.##");
                double result = p / 10d;
                //value = "+" + df.format(result) + "元";
                value = df.format(result);
            }
        }
        Logger.d("======PointsUtil=====getLeft======" + value);
        return value;
    }

    public static String getRight(String point) {

        Logger.d("======PointsUtil===getRight==point======" + point);

        String value = "0";

        if (!TextUtils.isEmpty(point)) {
            double p = Long.parseLong(point);
            if (p > 0) {
                DecimalFormat df = new DecimalFormat("#.##");
                double result = p / 365d;
                //value = "+" + df.format(result) + "金币";
                value = df.format(result);
            }
        }
        Logger.d("======PointsUtil=====getRight======" + value);
        return value;
    }


}
